#@weiXinLayout("预订活动")

#define weiXinMain()
#@navBar("预订活动","")
<form id="submitForm">
<div class="weui-cells__title">活动名称</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
           #(activity.name??'')
        </div>
    </div>
</div>
<div class="weui-cells__title">活动时间</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            #(activity.startTime()??'') 至 #(activity.endTime()??'')
        </div>
    </div>
</div>

<div class="weui-cells__title">活动集合地点</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            #(activity.address??'')
        </div>
    </div>
</div>

<div class="weui-cells__title">活动价格</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            ￥#(activity.price()??'')/人
        </div>
    </div>
</div>

<div class="weui-cells__title">联系人</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <input class="weui-input" name="activityOrder.name" id="name" type="text" placeholder="请输入联系人...">
        </div>
    </div>
</div>
<div class="weui-cells__title">联系电话</div>
<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <input class="weui-input" name="activityOrder.mobile" id="mobile" type="text" placeholder="请输入联系电话...">
        </div>
    </div>
</div>
    <div class="weui-cells__title">证件类型</div>
    <div class="weui-cells">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <input class="weui-input" id="cardPicker" type="text" placeholder="请选择证件类型...">
            </div>
        </div>
    </div>
    <div class="weui-cells__title">证件号码</div>
    <div class="weui-cells">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <input class="weui-input" name="activityOrder.card_no" id="cardNO" type="text" placeholder="请输入证件号码...">
            </div>
        </div>
    </div>



    <div class="weui-cells__title">留言信息</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <textarea class="weui-textarea" name="activityOrder.remarker" id="remarker" placeholder="假如你有什么特殊要求，请提前告诉我们，例如，我晕车，想做前面" rows="3"></textarea>
        </div>
    </div>
</div>
<div class="button-padding">
    <a href="javascript:;" id="submitBtn" class="weui-btn weui-btn_primary">保存我的报名信息</a>
    <input type="hidden" value="#(activity.id??'')" name="activityOrder.obj_id">
    <input type="hidden"  id="card_type_hidden" name="activityOrder.card_type">
    #(token??'')
</div>
</form>
#end

#define weiXinCss()
#end
#define weiXinJs()
<script>
    $(document).ready(function(){
        $("#cardPicker").select({
            title: "请选择您的证件类型",
            items: [
                {
                    title: "身份证",
                    value: "1",
                },
                {
                    title: "护照",
                    value: "2",
                },
                {
                    title: "台胞证",
                    value: "3",
                }
            ],
            onChange:function(){
                var values = $("#cardPicker").attr("data-values");
                $("#card_type_hidden").val(values);
            }
        });


        $("#submitBtn").click(function(){
            var data = $("#submitForm").serialize();
            var config ={
                "url":"#(contextPath)/weixin/activity/ajaxDoActivityOrder",
                "data":data,
                "successCallBack":function(resp){
                    if(resp.result){
                        $.alert("请确认你当前的活动预订订单",function(){
                            window.location.href="#(contextPath)/weixin/activity/activityOrderPreview?id="+resp.data;
                        });

                    }else{
                        $.alert(resp.data);
                    }
                }
            }

            $.confirm({
                "title":"系统提示",
                "text":"确定要进行当前操作吗?",
                "onOK":function () {
                    var ajax = new AjaxUtils(config);
                    ajax.executeRequest();
                }
            });
        })
    })
</script>
#end